#include "headers_cpp.h"
#include "sha1.h"

string brute_force(int index, string hash);
string brute_force(string start, string end, string hash);
string pwd_plaintext = "bacde";		// define password here
string start_range;
string end_range;

int main()
{
	bool	pwd_found = false;
	string	pwd_hash = sha1(pwd_plaintext);
	char alphabet[26];
    for(int i = 0; i < 26; i++) alphabet[i] = 'a' + i;
	int	set_size = sizeof(alphabet);
	
	cout << "Specify the password search bounds" << endl;
	cout << "Start Range: ";
	cin >> start_range;
	cout << "End Range: ";
	cin >> end_range;
	cout << endl << endl << endl;
	
	cout << endl;
	cout << "> > > > > >     SHA-1 Password Cracker    < < < < < < <" << endl;
	cout << "Hash Value: " << pwd_hash << endl;
	cout << "Range: " << start_range << " - " << end_range << endl;
	cout << "Calculating password... (may take a few minutes)" << endl;
	cout << endl;

	string temp_pwd = brute_force(start_range, end_range, pwd_hash);
	if(pwd_plaintext == temp_pwd)
	{
		cout << "MATCH FOUND" << endl << endl;
		cout << "Password:" << "\t" << temp_pwd << endl << endl;
		pwd_found = true;
	}

	if(!pwd_found)
		cout << "PASSWORD NOT FOUND" << endl;

	cout << "> > > > > > > > > >     EXITING     < < < < < < < < < <" << endl;
	int x;
	cin >> x;
}

